package cn.kgc.itrip.biz.controller;

import cn.kgc.itrip.beans.common.ServerResponse;
import cn.kgc.itrip.beans.model.vo.ItripAddUserLinkUserVo;
import cn.kgc.itrip.beans.model.vo.ItripModifyUserLinkUserVo;
import cn.kgc.itrip.beans.model.vo.ItripSearchUserLinkUserVo;
import cn.kgc.itrip.biz.service.IlinkUserService;
import cn.kgc.itrip.biz.service.UserorderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author 阿泽
 */
@Controller
@RequestMapping("/api/userinfo")
public class UserInfoController {

    /**
     * /api/userinfo/adduserlinkuser
     * 新增常用联系人接口
     */

    @Resource
   private UserorderService userorderService;
    @Resource
    private IlinkUserService queryLinkUserList;

    @RequestMapping(value = "/adduserlinkuser", method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse adduserlinkuser(@RequestBody ItripAddUserLinkUserVo itripAddUserLinkUserVo) {
        System.out.println(itripAddUserLinkUserVo.toString());
        return userorderService.adduserlinkuser(itripAddUserLinkUserVo);
    }



    /**
     * 修改常用联系人接口
     * POST /api/userinfo/modifyuserlinkuser
     */

    @RequestMapping(value = "/modifyuserlinkuser", method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse modifyuserlinkuser(@RequestBody ItripModifyUserLinkUserVo itripModifyUserLinkUserVO) {
        return userorderService.modifyuserlinkuser(itripModifyUserLinkUserVO);
    }

    /**
     * GET /api/userinfo/deluserlinkuser
     */

    @RequestMapping(value = "/deluserlinkuser", method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse deluserlinkuser(@RequestParam Integer ids) {
        return userorderService.deluserlinkuser(ids);
    }


    /*queryLinkUserList*/


    /**
     * 查询常用联系人接口
     * POST /api/userinfo/queryuserlinkuser
     */
    @RequestMapping(value = "/queryuserlinkuser", method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse queryLinkUserList(@RequestBody ItripSearchUserLinkUserVo itripSearchUserLinkUserVO, HttpServletRequest request) {

//
            return queryLinkUserList.queryLinkUserList(request.getHeader("token"),itripSearchUserLinkUserVO.getLinkUserName());


    }
    /**
     * 查询常用联系人接口
     * POST /api/userinfo/queryuserlinkuser
     */
   /* @RequestMapping(value = "/queryuserlinkuser", method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse queryuserlinkuser(@RequestBody ItripSearchUserLinkUserVo itripSearchUserLinkUserVO) {

        return userorderService.queryuserlinkuser(itripSearchUserLinkUserVO.getLinkUserName());
    }*/

}
